import urllib.request
import json
def saveDatas():
    for x in range(1,33):
        data = {"pagesize": 1000,
        "pageindex": x,
        "type": 2,
        "txt1":"",
        "CorpCode":"",
        "CorpName":"",
        "LegalMan":"",
        "CertTypeNum":"",
        "AreaCode":""}
        data_string=urllib.parse.urlencode(data)
        last_data=bytes(data_string,encoding='utf-8')
        f = urllib.request.urlopen("http://61.190.70.122:8003/epoint-mini/rest/function/searchSNQY",data=last_data)
        ltp_data = json.dumps(json.loads(f.read().decode('utf-8'))['all']['listinfo'])
        
        def save(filename, contents):
              fh = open(filename, 'w', encoding='utf-8')
              fh.write(contents)
              fh.close()
        save(f'/Users/wangshuguan/aa{x}.txt', ltp_data)
# saveDatas()
datas = []
for x in range(1,4):
    with open(f'/Users/wangshuguan/aa{x}.txt') as f:
        str = f.read()
        j = json.loads(str)
        for x1 in j:
            datas.append(x1)
companys = [x['corpname'] for x in datas]
for x in companys:
#     if x.find("公司") == -1 and  x.find("局") == -1 and  x.find("网") == -1 and  x.find("中心") == -1 and  x.find("院") == -1 and  x.find("平台") == -1 and  x.find("所") == -1 and  x.find("队") == -1 and  x.find("室") == -1 and  x.find("处") == -1 and  x.find("站") == -1 and  x.find("场") == -1 and  x.find("城") == -1 and  x.find("部") == -1 and  x.find("厂") == -1:
    print(x)

